package com.movitech.mobile.cz.base.modules.config;

/**
 * 采购流程类型
 * @author julius
 * @since 2018-03-16
 *
 */
public enum PurchasePlanFlowTypeEnum {
	PURCHASE_FLOW_TYPE_1("战略采购直接委托", 1,6),
	PURCHASE_FLOW_TYPE_2("战略采购邀请招标", 2,7),
	PURCHASE_FLOW_TYPE_3("战略采购竞争性谈判", 3,8),
	PURCHASE_FLOW_TYPE_4("专项采购零星采购", 4	,1),
	PURCHASE_FLOW_TYPE_5("专项采购战略直委", 5,2),
	PURCHASE_FLOW_TYPE_6("专项采购非战略直委", 6,3),
	PURCHASE_FLOW_TYPE_7("专项采购邀请招标", 7,4),
	PURCHASE_FLOW_TYPE_8("专项采购竞争性谈判", 8,5);
	
	private String desc;
	private int code;
	private int synCode;
	
	private PurchasePlanFlowTypeEnum(String desc, int code){
		this.desc = desc;
		this.code = code;
	}

	private PurchasePlanFlowTypeEnum(String desc, int code, int synCode){
		this.desc = desc;
		this.code = code;
		this.synCode = synCode;
	}

	public String getDesc() {
		return desc;
	}

	public void setDesc(String desc) {
		this.desc = desc;
	}

	public int getCode() {
		return code;
	}

	public void setCode(int code) {
		this.code = code;
	}

	public int getSynCode() {
		return synCode;
	}

	public void setSynCode(int synCode) {
		this.synCode = synCode;
	}

	public static String getNameByKey(int key){
		for(PurchasePlanFlowTypeEnum i :PurchasePlanFlowTypeEnum.values()){
			if(i.getCode()==key){
				return i.getDesc();
			}
		}
		return null;
	}

	public static Integer getSynCodeByKey(int key){
		for(PurchasePlanFlowTypeEnum i :PurchasePlanFlowTypeEnum.values()){
			if(i.getCode()==key){
				return i.getSynCode();
			}
		}
		return null;
	}

	public static Integer getKeyBySynCode(int synCode){
		for(PurchasePlanFlowTypeEnum i :PurchasePlanFlowTypeEnum.values()){
			if(i.getSynCode()==synCode){
				return i.getCode();
			}
		}
		return null;
	}

}
